// 自动生成模板Product
package products

import (
	"time"
)

// 商品管理 结构体  Product
type Product struct {
	ProductId  *int32     `json:"productId" form:"productId" gorm:"primarykey;column:product_id;"`            //商品id
	BrandId    *int32     `json:"brandId" form:"brandId" gorm:"column:brand_id;" binding:"required"`          //品牌
	CategoryId *int32     `json:"categoryId" form:"categoryId" gorm:"column:category_id;" binding:"required"` //分类
	Name       *string    `json:"name" form:"name" gorm:"column:name;size:255;" binding:"required"`           //商品名
	Price      *float64   `json:"price" form:"price" gorm:"column:price;size:10;" binding:"required"`         //价格
	Stock      *int32     `json:"stock" form:"stock" gorm:"column:stock;" binding:"required"`                 //库存
	ImgUrl     *string    `json:"imgUrl" form:"imgUrl" gorm:"column:img_url;size:255;"`                       //图片
	Status     *string    `json:"status" form:"status" gorm:"column:status;size:10;" binding:"required"`      //状态
	CreateTime *time.Time `json:"createTime" form:"createTime" gorm:"column:create_time;"`                    //新建时间
}

type ProductData struct {
	ProductId  *int32     `json:"productId" form:"productId" gorm:"primarykey;column:product_id;"`            //商品id
	BrandId    *int32     `json:"brandId" form:"brandId" gorm:"column:brand_id;" binding:"required"`          //品牌
	CategoryId *int32     `json:"categoryId" form:"categoryId" gorm:"column:category_id;" binding:"required"` //分类
	Name       *string    `json:"name" form:"name" gorm:"column:name;size:255;" binding:"required"`           //商品名
	Price      *float64   `json:"price" form:"price" gorm:"column:price;size:10;" binding:"required"`         //价格
	Stock      *int32     `json:"stock" form:"stock" gorm:"column:stock;" binding:"required"`                 //库存
	ImgUrl     *string    `json:"imgUrl" form:"imgUrl" gorm:"column:img_url;size:255;"`                       //图片
	Status     *string    `json:"status" form:"status" gorm:"column:status;size:10;" binding:"required"`      //状态
	CreateTime *time.Time `json:"createTime" form:"createTime" gorm:"column:create_time;"`                    //新建时间
	Brand      *string    `json:"brand" form:"brand" gorm:"column:brand;"`                                    //品牌
	Category   *string    `json:"category" form:"category" gorm:"column:category;"`                           //分类
}

// TableName 商品管理 Product自定义表名 product
func (Product) TableName() string {
	return "product"
}
